Zball in Tina townaccepts:397 submissions:2463 time limit:3000/1500 MS (java/others) Memory limit:262144/262144 K (java/others) P Roblem Description
Tina town was a friendly place. People there care on each of the other.
Tina has a ball called Zball. Zball is magic. It grows larger every day. On the first day, it becomes one time as large as its original size. On
Problem DescriptionTina town is a kind and friendly place where everyone cares about each other. Tina has a ball whose name is Zball. Zball is amazing, it gets bigger every day. On the first day, it gets bigger.11 time times. On the second day, it gets bigger.2Twice times. In sectionNN days, it gets bigger.N n times 。 Zball Original volume is 11. Tina would like
Zball in Tina townaccepts:397submissions:2463Time limit:3000/1500 MS (java/others)Memory limit:262144/262144 K (java/others) Problem DescriptionTina town was a friendly place. People there care on each of the other.Tina has a ball called Zball. Zball is magic. It grows larger every day. On the first day, it becomes 11 Time as large as its original size. On the se
Reprint Please specify source: http://www.cnblogs.com/fraud/--by fraudZball in Tina townTime limit:3000/1500 MS (java/others) Memory limit:262144/262144 K (java/others)Total submission (s): 219 Accepted Submission (s): 144Problem Descriptiontina Town was a friendly place. People there care on each of the other.Tina has a ball called Zball. Zball is magic. It grows larger every day. On the first day, it beco
Problem descriptionTina town is a kind and friendly place where everyone cares about each other.Tina has a ball whose name is Zball. Zball is amazing, it gets bigger every day. On the first day, it will be 11 times times bigger. On the second day, it will be 22 times times bigger. On the first NN day, it will become larger than the NN.The original volume of Zball
Test instructionsTina has a ball whose name is Zball. Zball is amazing, it gets bigger every day. On the first day, it will be 1 time times bigger. On the second day, it will be twice times bigger. In the nth day, it will become large n times.The original volume of Zball is 1. Tina would like to know how big the volume of the
Title Address: HDU 5391Test instructionsTina town is a kind and friendly place where everyone cares about each other. Tina has a ball whose name is Zball. Zball is amazing, it gets bigger every day. On the first day, it will be 11 times times bigger. On the second day, it will be 22 times times bigger. On the first NN day, it will become larger than the NN. The original volume of
Zball in Tina townaccepts:356submissions:2463Time limit:3000/1500 MS (java/others)Memory limit:262144/262144 K (java/others)Problem DescriptionTina town was a friendly place. People there care on each of the other.Tina has a ball called Zball. Zball is magic. It grows larger every day. On the first day, it becomes1 1 time as large as itsoriginal size. On the seco
Click here to transfer HDU 5391Alas, I thought that with 7 is basically a prime number, so always take 1007 to calculate, the result .... Alas, a bitter tear ah, forget, do not say, on the matter:Problem Descriptiontina Town isA friendly place. People there care AboutEach of the other. Tina has a ball called Zball. Zball isMagic. It grows largerevery Day. On the First Day,itbecomes111 Time asLarge as
Problem Descriptiontina Town was a friendly place. People there care on each of the other.Tina has a ball called Zball. Zball is magic. It grows larger every day. On the first day, it becomes1Time as large as its original size. On the second day,it would become 2 times as large as the size on the first day . On the n-th day,it would become n times as large as the size on the (n-1)-th Day. Tina want to k
(n-1)!/n is that if n is a prime number, it is equal to N-1else to 0.List of primes:Zball in Tina townTime limit:3000/1500 MS (java/others) Memory limit:262144/262144 K (java/others)Total submission (s): 833 Accepted Submission (s): 477Problem Descriptiontina Town was a friendly place. People there care on each of the other.Tina has a ball called Zball. Zball is magic. It grows larger every day. On the firs
Topic Connection: http://acm.hdu.edu.cn/showproblem.php?pid=5391The Wilson theorem in number theory, the topic directly gives the language description of the expression of Wilson's theorem.In elementary number theory, the Wilson theorem gives a sufficient and necessary condition for determining whether a natural count is a prime. That is: when and only if P is a prime number: (P-1)! ≡-1 (mod p), but because factorial is exploding, its conclusion is of little significance for practical operation.
Title Link: http://acm.hdu.edu.cn/showproblem.php?pid=5391Related Number theory conclusion:Wilson's theorem-when and only if P is a prime number: (P-1)! ≡p-1 (mod p)This problem at the beginning to see the time thought is the topic of violence, rapid factorial to take the mold, and then other problems do not come out to look at this problem,Found to be able to find the law, when P is composite, the P factor can all be found in the number factor in front of P,When P is prime, (p-1)!%p = p-1, try
started using __int64 to define variables, and the result is tle. Because of this situation, reported to try the mentality changed to int, on AC, ran more than 900 Ms.#include In fact, at the beginning of the time, have been thinking to sift out prime numbers to do. It was later written with the linear prime sieve method. But the effect is not good, also want 800ms.#include In fact, in the thinking of the method of handling primes to determine the prime number, thought there would be a great ef
Test instructions: (x-1)!modx (xThinking: When judging the prime number of the brain pumping, want to be a large numbers of primes, and then always tle;When the square root of the number to be judged is the 10^8 level, consider the large number of cases ...#include #include#includeusing namespacestd;intt,n,m;intMain () {intI,j,k,flag; scanf ("%d",t); while(t--) {scanf ("%d",N); if(n==4) {printf ("2\n");Continue; } Flag=0; for(i=2; i*i){ if(n%i==0) {flag=1; Break; } } if(flag) prin
HDU 5391 Zball in Tina Town (Wilson theorem)
Test instructions: Give an n, Beg (n-1). %n equals how much.
Wilson's theorem: When and only if N is a prime number: (n-1)!≡-1 (mod n)Solution: According to Wilson's theorem, p is the prime number of the answer is n-1. Think of the non-Prime, whose n can be multiplied by the preceding number, then the answer is 0. But the 4 answer exception is 2.
#include
Title Link: http://acm.hdu.edu.cn/showproblem.php?pid=5391
Test instructions: give you a N, ask you (N-1)! The value of% n.
This problem is a Wilson theorem, the content of Wilson's theorem is that if n is a prime number, then there must be (n-1)! %
Test Instructions: T Group test data, each group of data one N, Beg (N-1)!%p?
idea: Wilson's theorem: When and only if P is a prime number: (P-1)! ≡-1 (mod p), but 4 is an exception,
(4-1). ≡2 (mod 4).
The prime judgment is relatively slow and
Zball in Tina townaccepts:397submissions:2463Time limit:3000/1500 MS (java/others)Memory limit:262144/262144 K (java/others) Problem descriptionTina town is a kind and friendly place where everyone cares about each other. Tina has a ball whose name is Zball. Zball is amazing, it gets bigger every day. On the first day, it gets bigger. 1 Times. On the second day,
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.